import { defineStore } from "pinia";
import { onBeforeMount, reactive, watch } from "vue";
import { Local } from "@/utils";
import { DataViewLayoutConfig } from "@/const";

// 大屏布局
export const useDataViewLayoutStore = defineStore("dataViewLayout",()=>{
    const dataviewLayoutState = reactive({
        isShowChartList:true, //是否显示组件列表
        isShowLayer:true , //是否显示图层
        isShowSetting:true, //是否显示设置
        layoutContentWidth:null, //布局内容宽度
        layoutContentHeight:null, //布局内容高度
    })

    watch(dataviewLayoutState,()=>{
        Local.set(DataViewLayoutConfig,dataviewLayoutState)
    },{deep:true})

    onBeforeMount(()=>{
        Object.assign(dataviewLayoutState,Local.get(DataViewLayoutConfig))
    })
    return {
        dataviewLayoutState
    }
})